from tkinter import *

root = Tk()
list1=['插','入','一','个']

text=Text(root,undo=True)
text.grid(row=0,column=0)
text.insert(INSERT,'i love you')
text.mark_set('here',1.2)
text.mark_gravity("here", LEFT)


def show3():
    t=0
    print('show3')
    for i in list1:
        text.edit_separator()
        text.insert('here',list1[t])
        t+=1
def show1():
    text.edit_redo()
def show2():
    text.edit_undo()
    


Button(root,text='恢复',command=show1)\
                                      .grid(row=0,column=1,padx=10,pady=5)
Button(root,text='撤销',command=show2)\
                                      .grid(row=0,column=2,padx=10,pady=5)
Button(root,text='插入',command=show3)\
                                      .grid(row=0,column=3,padx=10,pady=5)


mainloop()
